<!DOCTYPE html>
<html>
<head>
<#include "../common/head.ftl">
</head>
<body>
<div class="wrapper">
    <div class="section">
        <div class="search-wrapper clearfix">
            <div class="pull-left">
                <form class="form-inline" id="search_form">
                    <div class="form-group">
                        <input type="text" name="keywords" class="form-control" placeholder="请输入名称或标识" maxlength="20">
                        <input type="hidden" name="pid" class="form-control">
                    </div>
                    <div class="form-group">
                        <label>类型：</label>
                        <select class="form-control w100" name="type" >
                            <option value="">-请选择-</option>
                            <@sysDictTag  namespace="workflow_type">
                                <#list noteDicts as noteDict>
                                    <option value="${noteDict.value}">${noteDict.label}</option>
                                </#list>
                            </@sysDictTag>
                        </select>
                    </div>
                    <button type="button" class="btn btn-default search-btn"><span class="fa fa-search"></span>&nbsp;查询</button>
                    <button type="reset" class="btn btn-default"><span class="fa fa-undo"></span>&nbsp;重置</button>
                </form>
            </div>
            <div class="pull-right">
                <button type="button" id="workflow_type_btn" class="btn btn-default"><span class="fa fa-plus"></span>&nbsp;新增流程类型</button>
                <button type="button" id="add_btn" class="btn btn-default"><span class="fa fa-plus"></span>&nbsp;新增配置</button>
            </div>
        </div>
        <div class="grid-wrapper">
            <table id="grid"></table>
            <div id="pager"></div>
        </div>
    </div>
</div>
<#include "../common/tab_oper.ftl">
</body>
<#include "../common/scripts.ftl">
<script type="text/javascript">
    var grid;
    grid = $("#grid").jqGrid({
        height: Public._win.gridBigHeight(),
        url: "work_flow_set/list/page",
        pager: "#pager",
        colModel: [
            {label:"操作",name:"ctrl",width:20,formatter:function(val,opt,obj){
                    var html = "<div class='operating'>";
                    html += "<shiro:hasPermission name='sys_resource:edit'><span class='fa fa-edit edit_btn' title='修改' data-id='"+obj.m.id+"'></span>&nbsp;&nbsp;</shiro:hasPermission>";
                    html += "<shiro:hasPermission name='sys_resource:delete'><span class='fa fa-trash delete_btn' title='删除' data-id='"+obj.m.id+"'></span></shiro:hasPermission>";
                    html += "</div>";
                    return html;
                }},
            {label:"ID",name:"m.id",key:true,hidden:true},
            {label:"名称",name:"m.flowName",width:40},
            {label:"当前节点名称",name:"m.currentNodeName",width:40},
            {label:"当前节点类型",name:"m.currentNodeType",width:40},
            {label:"下一节点名称",name:"m.nextNodeName",width:40},
            {label:"下一节点类型",name:"m.nextNodeType",width:40},
            {label:"操作名称",name:"m.btnChnName",width:40},
            {label:"操作类型",name:"m.operateType",width:40}
        ],
        loadComplete : function() {

        },
        gridComplete : function() {
            setTimeout(function() {
                Public._grid.autoSize(grid);
            }, 10);
        }
    });
    $(".search-btn").on("click",function(){
        grid.jqGrid("setGridParam",{postData:$("#search_form").serializeObject(),page:1}).trigger("reloadGrid");
    });

    $("#add_btn").on("click",function(){
        layer.open({
            type : 2,
            title : "新增配置",
            area : [ "1100px", "620px" ],
            content : "work_flow_set/add"
        });
    });
</script>
</html>